Repository navigation
refactor(core)!: ResolveLocalizationInput takes organizationId; the tenantId key is retired - #26078
Conversation
…enantId The key always meant the organization id; the old name let an environment id type-check. Renamed with no alias; the four in-repo callers and the localization tests are migrated, and a pin holds both the type refusal and the runtime absence of any alias. Claude-Session: https://claude.ai/code/session_014xf92fjdDKjycyVbyxMKm8 Co-authored-by: Claude <noreply@anthropic.com>
…xport-retired) Claude-Session: https://claude.ai/code/session_014xf92fjdDKjycyVbyxMKm8 Co-authored-by: Claude <noreply@anthropic.com>
…it is handed and holds the caller's bound Claude-Session: https://claude.ai/code/session_014xf92fjdDKjycyVbyxMKm8 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 4 package(s): 18 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 6 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 45 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4b7a97bf3d072a2d90bf170e281f11e7e84c8902 && git checkout 4b7a97bf3d072a2d90bf170e281f11e7e84c8902
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e0fe7d35ea21aed16bcdba93b93a2bda1b1f445c bcf5c8adf3dbb2b06f5bab2c0f566d26fc8fd810 && git checkout -B drift-repro e0fe7d35ea21aed16bcdba93b93a2bda1b1f445c && git merge --no-ff bcf5c8adf3dbb2b06f5bab2c0f566d26fc8fd810
node scripts/docs-audit/affected-docs.mjs --json e0fe7d35ea21aed16bcdba93b93a2bda1b1f445c
|
Contract reviewServed-tier: ① Derived judgments
② Semver levelChangeset Level: right. AGENTS.md Post-Task Checklist step 3 (maintainer ruling A, 2026-10-21): the level follows the metadata-protocol kind alone; a kind takes at least Arm: ADR-0087: right, and gate-verified. The marker Clause-②: no (narrowing) ③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #25555
Clause-②: no (narrowing)
Metadata-protocol: none
What changes
ResolveLocalizationInput.tenantId(@objectstack/core) is renamedorganizationId. The rename is immediate: there is no alias and no dual spelling. The key always meant the organization id: the settings service storeslocalizationunder the organization (ADR-0131 D8), and the directsys_settingfallback reads that organization's rows. An environment id passed under the old name type-checked, matched no organization, and resolved every non-UTC organization asUTC. Under the new name the mistake cannot be spelled. The old key is an excess-property error at every object-literal call, and the resolver reads no alias at run time.packages/core/src/security/resolve-authz-context.ts: the interface key, with a doc comment saying it takes an organization id and never an environment id. The two internal readers (the cached entry point and the uncached resolve) andlocalizationFallbackReachreadorganizationId. The cache-key docs follow the rename.core/security/request-execution-context.ts,mcp/src/plugin.ts,plugin-audit/src/audit-plugin.tsandplugin-hono-server/src/current-user-endpoints.ts. A re-grep oforigin/mainatbbf70614(includingui/) found no others. hotcrm has none either.packages/core/src/security/resolve-localization-organization-id.pin.test.tshas two halves:@ts-expect-errorontenantId.tsconfig.test.jsoncompiles this file, and the reverse check below shows it is live.organizationIdon both legs, the settings service and the direct fallback. AtenantIdsmuggled past the compiler reaches neither leg and resolvesUTC.not-required (runtime-export-retired @objectstack/core#ResolveLocalizationInput.tenantId). The gate verifies it.Not moved
The settings service's own scope argument,
{ tenantId, userId }onget/getMany, keeps its spelling. It is a separate public surface with its own callers across services, and renaming it is outside this card's acceptance, which is about the localization input. The resolver passes the organization id there unchanged, and the new pin asserts the scope it receives.External caller
objectstack-ai/cloud is the named external caller: cloud#3150 repaired its three AI entry points. This session cannot read that repository, so its
@objectstack/corepin is NOT MEASURED. The card says the callers pass an object literal. If that holds, the rename turns red at cloud's next core bump as a TS2353 excess-property error, and the fix is one key per call site. It does not fail silently. A non-literal call would drop the key without an error, so the changeset tells callers to grep fortenantIdbesideresolveLocalizationContext.Verification (head
bcf5c8adf; source change at4c667539)pnpm --filter PKG typecheckexit 0 for core, mcp, plugin-audit and plugin-hono-server. This includes core's test layer:check:test-typecheckOK, ledger unchanged at 4 files / 4 errors.pnpm --filter PKG testexit 0: core 120 files / 2772 tests, mcp 43 / 538, plugin-audit 60 / 993, plugin-hono-server 35 / 448.tenantId?: stringadded back to the interface (git hash-objectof the restored file equals the HEAD blob),check-test-typecheckexits 1. It names exactly the new pin file with 1 error, the unused@ts-expect-error.eslint --no-inline-configover the four packages'src: exit 0.node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 8 anchors judged, 0 lost.dispatch-gates.mjs --commands, 76 commands): the non-zero exits are listed in the report on the card.check:objectql-double-limitcaught the first version of the pin's engine double, which is fixed inbcf5c8adf.check:dts-closureandcheck:dual-build-cjs-loadsneed a full build and are NOT MEASURED locally; CI runs both.Acceptance notes
Generated by Claude Code